﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace MyLib 
{
    public class MyClass
    {
        public delegate void CallBack(String str);

        private int number = 10;
        public CallBack callback;

        public int id { set; get; }

        private void ThreadFunc()
        {
            
            while ((number--) != 0)
            {
                Thread.Sleep(1000);
                Console.WriteLine("The value is " + number);
            }
            callback("This is call back");
        }
        public void Func(CallBack func)
        {
            callback += func;

        }
        public MyClass()
        {
            Thread th = new Thread(this.ThreadFunc);
            th.Start();
        }
    }
}
